﻿using VuzixSample.model.snes.starfox;
using System.Collections.Generic;
using System;
using Microsoft.Xna.Framework;
using System.Diagnostics;
using VuzixSample.model.snes;

/* Gareth Williams
 * 
 * this loads and parses the starfox rom to extract header info and model geometry
 */

namespace VuzixSample.controller.snes
{
    abstract class RomParser
    {
        protected const uint OBJECT_DATA_OFFSET = 0x8F373;

        protected SnesRom _rom;
        public SnesRom rom
        {
            get
            {
                return _rom;
            }
            set
            {
                _rom = value;

                //now we have a rom parse it :)
                parse();
            }
        }

        public void Initialise()
        {
            //loads the starfox rom and fills out the rom data.
            var command = new LoadRomCommand();
            new RomLoadCompleteListener(command, this); //delegate
            command.Execute();
        }

        protected abstract void parse();
    }
}
